/*
 * @Author: xiaoyan
 * @Date: 2021-09-15 15:21:42
 * @LastEditors: xiaoyan
 * @LastEditTime: 2021-10-10 16:57:19
 * @Description: router
 * @FilePath: \vue3-ts-demo\src\router\index.ts
 */
import { createRouter,createWebHistory,RouteRecordRaw} from 'vue-router'
import layout from "@/layout/index.vue"
export const constantRoutes:Array<RouteRecordRaw>= [
    {
        path:'',
        component:()=>import('@/views/home.vue'),
        meta:{
            title:"首页",
            hidden:true,
        },
    },
    {
        path:"/login",
        component:()=>import("@/views/login/index.vue"),
        meta:{
            title:"登录",
            hidden:true,
        },
    },
    {
        path:"/cases",
        component:layout,
        meta:{
            title:"案件管理",
            icon:"el-icon-user",
            alwaysShow: true
        },
        name:"Cases",
        children:[
            {
                path:"list",
                component:()=>import("@/views/cases/list.vue"),
                name:"CasesList",
                meta:{title:"案件列表",icon:"el-icon-user"},
            },
            {
                path:"list1",
                component:()=>import("@/views/cases/list.vue"),
                name:"CasesList1",
                meta:{title:"案件列表1",icon:"el-icon-user"},
            },
        ],
    },
];
const router = createRouter({
    history:createWebHistory(),
    routes:constantRoutes,
});
export function resetRouter(){
    const newRouter = router;
    (router as any).matcher = (newRouter as any).matcher
}
export default router;